package cn.iocoder.yudao.module.infra.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * 工单状态枚举
 *
 */
@AllArgsConstructor
@Getter
public enum TicketStatusEnum {

    PENDING(1, "待处理"),
    PROCESSING(2, "处理中"),
    COMPLETED(3, "已完成"),
    CLOSED(4, "已关闭"),
    TIMEOUT(5, "已超时"),
    REJECT(6,"已拒绝");

    private final int code;
    private final String desc;

    private static final Map<Integer, String> descMap = Arrays.stream(values())
            .collect(Collectors.toMap(e -> e.code, e -> e.desc));

    public static String getDescByCode(Integer code) {
        return descMap.getOrDefault(code, "未知状态");
    }

}
